﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using SD.Database;

namespace smallDeimos.Game
{
    public partial class CreateMessage : System.Web.UI.Page
    {
        int UserId;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["sd_id"] != null)
            {
                HttpCookie cookie2 = Request.Cookies["sd_id"];
                UserId = int.Parse(cookie2.Value);
            }
            else
            {
                Session["Error"] = "Cookie sd_id doesn't exists";
                Response.Redirect("~/Error.aspx");
                return;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            StoredProcedures.SentMessage(UserId, int.Parse(DropDownList1.SelectedItem.Value), TextBox1.Text);
            statusLbl.Text = "Message sent.";
        }
    }
}
